package com.miracle9.game.dao;

import com.miracle9.game.entity.Version;
import org.hibernate.Query;
import org.springframework.stereotype.Repository;

@Repository
public class VersionServiceDao extends SqlOperating<Version, Integer> {

    public Version getByType(int type) {
        Query query = q_CreateSql("from Version where type=? order by id desc", new Object[]{Integer.valueOf(type)});
        query.setMaxResults(1);
        return (Version) query.uniqueResult();
    }

    public Version getByVersionCode(String type) {
        Query query = q_CreateSql("from Version where type=? order by id desc", new Object[]{Integer.valueOf(type)});
        query.setMaxResults(1);
        return (Version) query.uniqueResult();
    }
}